🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / settings / src / commonMain / kotlin / org / meshtastic / feature / settings / radio / component / LoRaBandwidthPolicy.kt
Displaying Raw • Download
feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/radio/component/LoRaBandwidthPolicy.kt 65a1f5ce4d0e4b8eafcd0bbfccafd41dc6ee888a (65a1f5ce) Text, 3.37 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.radio.component
Tff7b72import T7ee787org.meshtastic.proto.Config.LoRaConfig.RegionCode
Tff7b72import T7ee787org.meshtastic.proto.HardwareModel
Tff7b72internal Tff7b72data Tff7b72class T56d364LoRaBandwidthOptionTb4b4b4(Tff7b72val Te6edf3wireValueTb4b4b4: Tffa657IntTb4b4b4, Tff7b72val Te6edf3displayKilohertzTb4b4b4: Tffa657StringTb4b4b4)
Tff7b72internal Tff7b72data Tff7b72class T56d364LoRaBandwidthSelectionTb4b4b4(
T8b949e/** Null outside LORA_24, where Android's existing numeric input remains unconstrained. */
Tff7b72val Te6edf3optionsTb4b4b4: Te6edf3ListTff7b72<Te6edf3LoRaBandwidthOptionTff7b72>Tff7b72?Tb4b4b4,
T8b949e/** An unsupported stored value that the UI must keep visible until the user replaces it. */
Tff7b72val Te6edf3invalidPersistedValueTb4b4b4: Tffa657Int?Tb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3isValidTb4b4b4: Tffa657Boolean
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3invalidPersistedValue Tff7b72=Tff7b72= Tff7b72null
Tff7b72fun Td2a8ffallowsSaveTb4b4b4(Te6edf3usePresetTb4b4b4: Tffa657BooleanTb4b4b4)Tb4b4b4: Tffa657Boolean Tff7b72= Te6edf3usePreset Tff7b72|Tff7b72| Te6edf3isValid
Tb4b4b4}
Tff7b72private Tff7b72const Tff7b72val Te6edf3SX128X_WIDEST_BANDWIDTH_CODE Tff7b72= T79c0ff1T79c0ff6T79c0ff0T79c0ff0
Tff7b72private Tff7b72val Te6edf3LORA_24_DEFAULT_OPTION Tff7b72= Te6edf3LoRaBandwidthOptionTb4b4b4(T79c0ff0Tb4b4b4, Ta5d6ff"Ta5d6ff812.5Ta5d6ff"Tb4b4b4)
Tff7b72private Tff7b72val Te6edf3CONSERVATIVE_HIGH_BAND_OPTIONS Tff7b72=
Te6edf3listOfTb4b4b4(Te6edf3LoRaBandwidthOptionTb4b4b4(T79c0ff2T79c0ff0T79c0ff0Tb4b4b4, Ta5d6ff"Ta5d6ff203.125Ta5d6ff"Tb4b4b4)Tb4b4b4, Te6edf3LoRaBandwidthOptionTb4b4b4(T79c0ff4T79c0ff0T79c0ff0Tb4b4b4, Ta5d6ff"Ta5d6ff406.25Ta5d6ff"Tb4b4b4)Tb4b4b4, Te6edf3LoRaBandwidthOptionTb4b4b4(T79c0ff8T79c0ff0T79c0ff0Tb4b4b4, Ta5d6ff"Ta5d6ff812.5Ta5d6ff"Tb4b4b4)Tb4b4b4)
Tff7b72private Tff7b72val Te6edf3SX128X_ONLY_TARGETS Tff7b72=
Te6edf3setOfTb4b4b4(
Ta5d6ff"Ta5d6ffbetafpv_2400_tx_microTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffmakerpython_nrf52840_sx1280_einkTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffmakerpython_nrf52840_sx1280_oledTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffmy-esp32s3-diy-einkTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffmy-esp32s3-diy-oledTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6fftlora-v2-1-1_8Ta5d6ff"Tb4b4b4,
Tb4b4b4)
Tff7b72private Tff7b72val Te6edf3SX128X_EXCLUDED_HARDWARE_MODELS Tff7b72= Te6edf3setOfTb4b4b4(Te6edf3HardwareModelTb4b4b4.Te6edf3TLORA_T3_S3Tb4b4b4, Te6edf3HardwareModelTb4b4b4.Te6edf3MUZI_BASETb4b4b4)
T8b949e/**
* Returns the custom-bandwidth policy for the destination radio.
*
* Current protobufs report a PlatformIO target only for the directly connected node and do not report the radio chip
* selected at runtime. Therefore 1600 is granted only to exact firmware targets that compile exclusively for SX128x.
* Mixed, remote, and unknown targets use the LR1121-safe conservative set.
*/
Tff7b72internal Tff7b72fun Td2a8ffloRaBandwidthSelectionTb4b4b4(
Te6edf3storedValueTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3regionTb4b4b4: Te6edf3RegionCodeTb4b4b4,
Te6edf3hwModelTb4b4b4: Te6edf3HardwareModel?Tb4b4b4,
Te6edf3pioEnvTb4b4b4: Tffa657String?Tb4b4b4,
Tb4b4b4)Tb4b4b4: Te6edf3LoRaBandwidthSelection Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3region Tff7b72!Tff7b72= Te6edf3RegionCodeTb4b4b4.Te6edf3LORA_24Tb4b4b4) Tff7b72return Te6edf3LoRaBandwidthSelectionTb4b4b4(Te6edf3options Tff7b72= Tff7b72nullTb4b4b4, Te6edf3invalidPersistedValue Tff7b72= Tff7b72nullTb4b4b4)
Tff7b72val Te6edf3sx128xOnly Tff7b72=
Te6edf3hwModel Tff7b72!in Te6edf3SX128X_EXCLUDED_HARDWARE_MODELS Tff7b72&Tff7b72& Te6edf3pioEnvTff7b72?.Te6edf3lowercaseTb4b4b4(Tb4b4b4)Tff7b72?.Te6edf3letTb4b4b4(Te6edf3SX128X_ONLY_TARGETSTff7b72::Te6edf3containsTb4b4b4) Tff7b72=Tff7b72= Tff7b72true
Tff7b72val Te6edf3supportedOptions Tff7b72=
Tff7b72if Tb4b4b4(Te6edf3sx128xOnlyTb4b4b4) Tb4b4b4{
Te6edf3CONSERVATIVE_HIGH_BAND_OPTIONS Tff7b72+ Te6edf3LoRaBandwidthOptionTb4b4b4(Te6edf3SX128X_WIDEST_BANDWIDTH_CODETb4b4b4, Ta5d6ff"Ta5d6ff1625Ta5d6ff"Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3CONSERVATIVE_HIGH_BAND_OPTIONS
Tb4b4b4}
Tff7b72val Te6edf3options Tff7b72= Te6edf3listOfTb4b4b4(Te6edf3LORA_24_DEFAULT_OPTIONTb4b4b4) Tff7b72+ Te6edf3supportedOptions
Tff7b72val Te6edf3invalidPersistedValue Tff7b72= Te6edf3storedValueTb4b4b4.Te6edf3takeUnless Tb4b4b4{ Te6edf3value Tff7b72-Tff7b72> Te6edf3optionsTb4b4b4.Te6edf3any Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3wireValue Tff7b72=Tff7b72= Te6edf3value Tb4b4b4} Tb4b4b4}
Tff7b72return Te6edf3LoRaBandwidthSelectionTb4b4b4(Te6edf3options Tff7b72= Te6edf3optionsTb4b4b4, Te6edf3invalidPersistedValue Tff7b72= Te6edf3invalidPersistedValueTb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s